package com.example.service;

import com.example.entity.Employee;
import com.example.mapper.EmployeeMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeService {
    @Resource
    private EmployeeMapper employeeMapper;

    public void add(Employee employee) {
        employeeMapper.insert(employee);
    }
    public void delete(String ids) {
        employeeMapper.delete(ids);
    }
    public void update(Employee employee) {
        employeeMapper.updateById(employee);
    }

    public PageInfo<Employee> selectPage(int pageNum, int pageSize, Long id, String name) {
        PageHelper.startPage(pageNum, pageSize);
        List<Employee> employees = employeeMapper.selectPage(id, name);
        return new PageInfo<>(employees);
    }


}
